<template>
    <div class="leave-student-list edu-page-warp">
        <condition-card
            label-position="right"
            label-width="120px"
            @search="filtration"
            @reset="reset('queryForm')"
        >
            <el-row :gutter="24">
                <el-col :span="8">
                    <el-form-item label="当前年级" prop="grade">
                        <el-date-picker
                            style="width: 100%;"
                            v-model="queryForm.grade"
                            type="year"
                            placeholder="请选择"
                            value-format="yyyy"
                            :picker-options="pickerOptions"
                            @change="currentDptId === '1' ? changeFaculty() : ''"
                        ></el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="学院">
                        <DictSelect
                            labelAll="请选择"
                            v-model="multipeQuery.faculty"
                            filterable
                            :data="options.faculty"
                            multiple
                            @change="changeFaculty"
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="专业">
                        <DictSelect
                            labelAll="请选择"
                            v-model="multipeQuery.profession"
                            filterable
                            :data="options.profession"
                            multiple
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="培养层次">
                        <DictSelect
                            labelAll="请选择"
                            v-model="multipeQuery.trainingLevel"
                            :data="options.trainingLevel"
                            multiple
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="培养类别">
                        <DictSelect
                            labelAll="请选择"
                            v-model="queryForm.trainingCategory"
                            :data="options.trainingCategory"
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="学位类型">
                        <DictSelect
                            labelAll="请选择"
                            v-model="queryForm.degreeType"
                            :data="options.degreeType"
                            @change="currentDptId !== '1' ? changeFaculty() : ''"
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="学习形式">
                        <DictSelect
                            labelAll="请选择"
                            v-model="queryForm.formLearning"
                            :data="options.formLearning"
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="培养完成情况">
                        <DictSelect
                            labelAll="请选择"
                            v-model="queryForm.cultureStatus"
                            :data="options.cultureStatus"
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="是否获毕业证">
                        <YesNoSelect
                            v-model="queryForm.isGetDiploma"
                            labelAll="请选择"
                            :showAll="false"
                        ></YesNoSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="是否获学位证">
                        <YesNoSelect
                            v-model="queryForm.isGetDegreeCertificate"
                            labelAll="请选择"
                            :showAll="false"
                        ></YesNoSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="在校状态">
                        <DictSelect
                            labelAll="请选择"
                            v-model="queryForm.leaveSchool"
                            :data="options.leaveSchool"
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="是否国际学生">
                        <YesNoSelect v-model="queryForm.isOverseas" labelAll="请选择" :showAll="false"></YesNoSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="是否双学位">
                        <YesNoSelect
                            v-model="queryForm.isDoubleDegree"
                            labelAll="请选择"
                            :showAll="false"
                        ></YesNoSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="学制">
                        <DictSelect
                            labelAll="请选择"
                            v-model="queryForm.lengthSchooling"
                            :data="options.termList"
                        ></DictSelect>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="入学时间">
                        <el-row type="flex" justify="center" align="middle">
                            <el-date-picker
                                v-model="queryForm.enrolDateStar"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                type="date"
                                align="right"
                                placeholder="选择开始时间"
                            ></el-date-picker>
                            <span style="margin: 0 10px;">~</span>
                            <el-date-picker
                                v-model="queryForm.enrolDateEnd"
                                type="date"
                                align="right"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                placeholder="选择结束时间"
                            ></el-date-picker>
                        </el-row>
                    </el-form-item>
                </el-col>
                <el-col v-if="currentDptId == 2 || currentDptId == 4" :span="8" :pull="16">
                    <el-form-item label="离校时间">
                      <el-row type="flex" justify="center" align="middle">
                        <el-date-picker
                          v-model="queryForm.offSchoolStar"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          type="date"
                          align="right"
                          placeholder="选择开始时间"
                        ></el-date-picker>
                        <span style="margin: 0 10px;">~</span>
                        <el-date-picker
                          v-model="queryForm.offSchoolEnd"
                          type="date"
                          align="right"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="选择结束时间"
                        ></el-date-picker>
                      </el-row>
                    </el-form-item>
                </el-col>
            </el-row>
        </condition-card>
        <el-card shadow="never" body-style="padding: 24px;">
            <h2 class="edu-page-title">{{ $t('message.leaveStudentList') }}</h2>
            <el-row type="flex" align="center" class="edu-opertion-bar">
                <el-col>
                    <!-- <KeywordInput
                        v-model="queryForm.keyWord"
                        @enter="onSubmit"
                        placeholder="学号或姓名搜索"
                    ></KeywordInput> -->
                    <el-input
                        style="width:250px"
                        v-model="queryForm.keyWord"
                        :placeholder="$t('score.failScoreManage.pleaseInt')"
                        prefix-icon="el-icon-search"
                        @keyup.enter.native="onSubmit"/>
                </el-col>
                <el-col class="text-right">
                    <el-dropdown
                      trigger="click"
                      @command="handleImportDiplomaCertificate"
                      v-if="isGraduateStudent()"
                      v-premit="'importDiplomaCertificate'"
                    >
                      <el-button>
                        导入学位证号
                        <i class="el-icon-arrow-down el-icon--right"></i>
                      </el-button>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="import">导入</el-dropdown-item>
                        <el-dropdown-item command="download">模板下载</el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                    <el-upload
                    action="/api/studentservice/studentdeparture/importDiplomaCertificate"
                    style="display: none;"
                    ref="importDiplomaCertificateUpload"
                    :file-list="uploadConfig.diplomaCertificateFileList"
                    :on-success="handleDiplomaImportSuccess"
                    :on-error="handleDiplomaImportError"
                    accept=".xlsx"
                    :auto-upload="true"
                    :show-file-list="false"
                  >
                    <span slot="trigger" ref="importDiplomaCertificate"/>
                  </el-upload>
                    <el-dropdown
                    trigger="click"
                    @command="handleImportGraduationCertificate"
                    v-if="isGraduateStudent()"
                    v-premit="'importGraduationCertificate'"
                  >
                    <el-button>
                      导入学历证号
                      <i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item command="import">导入</el-dropdown-item>
                      <el-dropdown-item command="download">模板下载</el-dropdown-item>
                    </el-dropdown-menu>
                  </el-dropdown>
                    <el-upload
                    action="/api/studentservice/studentdeparture/importGraduationCertificate"
                    style="display: none;"
                    ref="importGraduationCertificateUpload"
                    :file-list="uploadConfig.graduationCertificateFileList"
                    :on-success="handleImportGraduationSuccess"
                    :on-error="handleImportGraduationError"
                    accept=".xlsx"
                    :auto-upload="true"
                    :show-file-list="false"
                  >
                    <span slot="trigger" ref="importGraduationCertificate"/>
                  </el-upload>
                    <el-dropdown
                        trigger="click"
                        @command="handleCommand"
                        v-if="currentUid !== 'admin1'"
                    >
                        <el-button>
                            导入
                            <i class="el-icon-arrow-down el-icon--right"></i>
                        </el-button>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item command="import">离校导入</el-dropdown-item>
                            <el-dropdown-item command="download">导入模板下载</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                    <el-upload
                        action="/api/studentservice/studentdeparture/importDepartureList"
                        style="display: none;"
                        ref="upload"
                        :file-list="uploadConfig.fileList"
                        :on-success="handlerSuccess"
                        :on-error="handlerError"
                        accept=".xlsx"
                        :auto-upload="true"
                        :show-file-list="false"
                    >
                        <span slot="trigger" ref="importBtn">离校导入</span>
                    </el-upload>
                    <el-button plain @click="exportFile">{{ $t('message.export') }}</el-button>
                    <el-button type="primary" @click="leavelonly">自动离校</el-button>
                    <el-button
                        type="primary"
                        @click="batchLeaveSchool"
                        v-if="currentUid !== 'admin1'"
                    >离校</el-button>
                </el-col>
            </el-row>
            <edu-table
                ref="academicTable"
                :data="students.data"
                :total="students.total_"
                :pageNum="queryForm.pageNum_"
                :order="false"
                @page-change="handleCurrentChange"
                @selection-change="handlerSelectionChange"
                :selection="false"
                :page-sizes="[10, 20, 50, 100, 500, 1000]"
            >
              <!-- 本科生 -->
              <template v-if="isUndergraduate()">
                <el-table-column type="selection" fixed="left" width="30" />
                <el-table-column label="学号" prop="studentId" show-overflow-tooltip fixed></el-table-column>
                <el-table-column label="姓名" prop="studentName" show-overflow-tooltip fixed></el-table-column>
                <el-table-column label="当前年级" show-overflow-tooltip fixed>
                    <template slot-scope="scope">{{ scope.row.grade }}</template>
                </el-table-column>
                <el-table-column label="学院" show-overflow-tooltip fixed>
                    <template slot-scope="scope">{{ scope.row.facultyI18n}}</template>
                </el-table-column>
                <el-table-column label="专业" show-overflow-tooltip fixed>
                    <template slot-scope="scope">{{ scope.row.professionI18n }}</template>
                </el-table-column>
                <el-table-column label="培养层次" show-overflow-tooltip>
                    <template slot-scope="scope">{{ scope.row.trainingLevelI18n }}</template>
                </el-table-column>
                <el-table-column label="培养类别" show-overflow-tooltip>
                    <template slot-scope="scope">{{ scope.row.trainingCategoryI18n }}</template>
                </el-table-column>
                <el-table-column label="学位类型" show-overflow-tooltip>
                    <template slot-scope="scope">{{ scope.row.degreeTypeI18n }}</template>
                </el-table-column>
                <el-table-column label="学习形式" show-overflow-tooltip>
                    <template slot-scope="scope">{{ scope.row.formLearningI18n }}</template>
                </el-table-column>
                <el-table-column label="培养完成情况" width="120px" show-overflow-tooltip>
                    <template slot-scope="scope">
                        {{ getCultureStatus(scope.row.cultureStatus) }}
                      <!-- {{ scope.row.cultureStatus }} -->
                        </template>
                </el-table-column>
                <el-table-column label="是否获毕业证" width="120px" show-overflow-tooltip>
                    <template slot-scope="scope">
                        <div class="text-center" v-if="scope.row.isGetDiploma">
                            <el-tag
                              :type="scope.row.isGetDiploma*1?'success':'danger'"
                            >
                            <!-- {{ scope.row.isGetDiploma }} -->
                            {{ getDiploma(scope.row.isGetDiploma) }}
                            </el-tag>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="是否获学位证" width="120px" show-overflow-tooltip>
                    <template slot-scope="scope">
                        <div class="text-center" v-if="scope.row.isGetDegreeCertificate">
                            <el-tag
                              :type="scope.row.isGetDegreeCertificate*1?'success':'danger'"
                            >
                            <!-- {{ scope.row.isGetDegreeCertificate }} -->
                            {{ getDegreeCertificate(scope.row.isGetDegreeCertificate) }}
                            </el-tag>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="是否国际学生" width="120px" show-overflow-tooltip>
                    <template slot-scope="scope">
                        <div class="text-center" v-if="scope.row.isOverseas">
                            <el-tag
                              :type="scope.row.isOverseas*1?'success':'danger'"
                            >{{ getIsOverseas(scope.row.isOverseas) }}</el-tag>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="是否双学位" width="100px" show-overflow-tooltip>
                    <template slot-scope="scope">
                        <div class="text-center" v-if="scope.row.isDoubleDegreeI18n">
                            <el-tag
                              :type="scope.row.isDoubleDegree*1?'success':'danger'"
                            >{{ scope.row.isDoubleDegreeI18n }}</el-tag>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="预计离校时间" width="120px" show-overflow-tooltip fixed="right">
                    <template slot-scope="scope">
                        <span v-if='scope.row.expectLeaveDate'>{{ scope.row.expectLeaveDate }}</span>
                        <span v-else>{{ scope.row.expectedGraduationDate }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="在校状态" show-overflow-tooltip fixed="right">
                    <template slot-scope="scope">{{ scope.row.leaveSchoolI18n }}</template>
                </el-table-column>
                <el-table-column label="离校时间" show-overflow-tooltip fixed="right">
                    <template slot-scope="scope">{{ scope.row.offSchool}}</template>
                </el-table-column>
              </template>
              <!-- 研究生 -->
              <template v-if="isGraduateStudent()">
                <el-table-column type="selection" fixed="left" width="30" />
                <el-table-column label="学号" prop="studentId" show-overflow-tooltip width="100" fixed="left"/>
                <el-table-column label="姓名" prop="studentName" show-overflow-tooltip width="100" fixed="left"/>
                <el-table-column label="培养层次" prop="trainingLevelI18n" show-overflow-tooltip width="100" fixed="left"/>
                <el-table-column label="导师" prop="teacher" show-overflow-tooltip width="120" fixed="left"/>

                <el-table-column label="年级" prop="grade" show-overflow-tooltip width="100"/>
                <el-table-column label="学院" prop="facultyI18n" show-overflow-tooltip width="100"/>
                <el-table-column label="专业" prop="professionI18n" show-overflow-tooltip width="100"/>
                <el-table-column label="培养类别" prop="trainingCategoryI18n" show-overflow-tooltip width="100"/>
                <el-table-column label="培养完成情况" show-overflow-tooltip width="140">
                  <template slot-scope="scope">
                    {{ getCultureStatus(scope.row.cultureStatus) }}
                  </template>
                </el-table-column>
                <el-table-column label="是否获毕业证" prop="studentId" show-overflow-tooltip width="140">
                  <template slot-scope="scope">
                    <div class="text-center">
                        <el-tag
                          :type="scope.row.graduationCertificateNo ? 'success' : 'danger'"
                        >
                        {{ scope.row.graduationCertificateNo ? '是' : '否' }}
                        </el-tag>
                    </div>
                    </template>
                </el-table-column>
                <el-table-column label="是否获学位证" show-overflow-tooltip width="140">
                  <template slot-scope="scope">
                    <div class="text-center">
                        <el-tag
                          :type="scope.row.academicDegreeCertificateNo ? 'success' : 'danger'"
                        >
                        {{ scope.row.academicDegreeCertificateNo ? '是' : '否' }}
                        </el-tag>
                    </div>
                    </template>
                </el-table-column>
                <el-table-column label="是否在籍" show-overflow-tooltip width="100">
                  <template slot-scope="scope">
                    <el-tag
                      type="danger"
                      v-if="scope.row.isMembership == 0"
                    >{{ scope.row.isMembershipI18n }}</el-tag>
                    <el-tag
                      type="success"
                      v-else-if="scope.row.isMembership == 1"
                    >{{ scope.row.isMembershipI18n }}</el-tag>
                  </template>
                </el-table-column>
                <el-table-column label="是否国际学生" show-overflow-tooltip width="160">
                  <template slot-scope="scope">
                    <div class="text-center" v-if="scope.row.isOverseas">
                        <el-tag
                          :type="scope.row.isOverseas*1?'success':'danger'"
                        >{{ getIsOverseas(scope.row.isOverseas) }}</el-tag>
                    </div>
                    </template>
                </el-table-column>
                <el-table-column label="是否双学位" show-overflow-tooltip width="140">
                  <template slot-scope="scope">
                    <div class="text-center" v-if="scope.row.isDoubleDegreeI18n">
                        <el-tag
                          :type="scope.row.isDoubleDegree*1?'success':'danger'"
                        >{{ scope.row.isDoubleDegreeI18n }}</el-tag>
                    </div>
                    </template>
                </el-table-column>
                <el-table-column label="在校状态" prop="leaveSchoolI18n" show-overflow-tooltip width="100"/>
                <el-table-column label="离校时间" prop="offSchool" show-overflow-tooltip width="100"/>
              </template>
              <el-table-column
                  label="操作"
                  width="100px"
                  fixed="right"
                  v-if="currentUid !== 'admin1'"
              >
                  <template slot-scope="scope">
                      <el-button
                          v-if="currentDptId == 2 || currentDptId == 4"
                          type="text"
                          @click="query(scope.row)"
                      >查看</el-button>
                      <el-button
                          v-if="scope.row.leaveSchool == '4'"
                          type="text"
                          @click="repeal(scope.row)"
                      >撤销</el-button>
                      <el-button v-else type="text" @click="singleLeaveSchool(scope.row)">离校</el-button>
                  </template>
              </el-table-column>
            </edu-table>
        </el-card>
        <!--离校弹框-->
        <edu-dialog
            ref="leaveSchoolDialog"
            @close="closeLeaveSchoolDialog"
            :isCustomTitle="true"
            size="medium"
            class="dialog"
        >
            <edu-dialog ref="innerDialog" title="提示" append-to-body class="tip-item">
                返回将不会保存离校操作，是否确定？
                <span slot="buttons" class="dialog-footer">
                    <el-button @click="cancleInner">取消</el-button>
                    <el-button type="primary" @click="confirmInner">确定</el-button>
                    <el-button type="primary" @click="confirmAndSave">保存并关闭</el-button>
                </span>
            </edu-dialog>
            <span slot="title" class="dialog-title">{{leaveSchoolDialog.dialogTitle}}</span>
            <div class="basic-info" v-if="leaveSchoolDialog.showBasicInfo">
                <div class="dialog-info-title mt-10px mb-24px">基本信息</div>
                <div class="details-table">
                    <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">学号:</div>
                                <div class="div-flex-last-right">{{currentData.studentId}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">姓名:</div>
                                <div class="div-flex-last-right">{{currentData.studentName}}</div>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">学院:</div>
                                <div class="div-flex-last-right">{{currentData.facultyI18n}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">专业:</div>
                                <div class="div-flex-last-right">{{currentData.professionI18n}}</div>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">年级:</div>
                                <div class="div-flex-last-right">{{currentData.grade}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">培养层次:</div>
                                <div class="div-flex-last-right">{{currentData.trainingLevelI18n}}</div>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">培养类别:</div>
                                <div
                                    class="div-flex-last-right"
                                >{{currentData.trainingCategoryI18n}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">导师:</div>
                                <div class="div-flex-last-right">{{currentData.teacher}}</div>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">学位类型:</div>
                                <div class="div-flex-last-right">{{currentData.degreeTypeI18n}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">学习形式:</div>
                                <div class="div-flex-last-right">{{currentData.formLearningI18n}}</div>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">是否获毕业证:</div>
                                <div class="div-flex-last-right">{{isGetGraduationCertificate(currentData)}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">是否获学位证:</div>
                                <div
                                    class="div-flex-last-right"
                                >{{isGetAcademicDegreeCertificate(currentData)}}</div>
                            </div>
                        </el-col>
                        <!-- <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">毕业证发放时间:</div>
                                <div class="div-flex-last-right">{{currentData.isGetDiplomaDate}}</div>
                            </div>
                        </el-col> -->
                    </el-row>
                    <!-- <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">是否获学位证:</div>
                                <div
                                    class="div-flex-last-right"
                                >{{isGetAcademicDegreeCertificate(currentData)}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">学位证发放时间:</div>
                                <div
                                    class="div-flex-last-right"
                                >{{currentData.isGetDegreeCertificateDate}}</div>
                            </div>
                        </el-col>
                    </el-row> -->
                    <el-row class="row-height" type="flex" justify="center">
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">在校状态:</div>
                                <div class="div-flex-last-right">{{currentData.leaveSchoolI18n}}</div>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="div-flex">
                                <div class="div-flex-left">是否国际学生：</div>
                                <div class="div-flex-last-right">{{currentData.isOverseas * 1 ? '是' : '否'}}</div>
                            </div>
                        </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                    <el-col :span="12">
                      <div class="div-flex">
                        <div class="div-flex-left">是否在籍:</div>
                        <div class="div-flex-last-right">{{currentData.isMembershipI18n}}</div>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="div-flex">
                        <div class="div-flex-left">预计离校时间：</div>
                        <div class="div-flex-last-right">{{currentData.expectLeaveDate || currentData.expectedGraduationDate}}</div>
                      </div>
                    </el-col>
                  </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                      <el-col :span="12">
                        <div class="div-flex">
                          <div class="div-flex-left">离校时间:</div>
                          <div class="div-flex-last-right">{{currentData.offSchool}}</div>
                        </div>
                      </el-col>
                      <el-col :span="12">
                        <div class="div-flex">
                          <div class="div-flex-left">毕结业结论：</div>
                          <div class="div-flex-last-right">{{currentData.registrationStatusI18n}}</div>
                        </div>
                      </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                      <el-col :span="12">
                        <div class="div-flex">
                          <div class="div-flex-left">学位证号:</div>
                          <div class="div-flex-last-right">{{currentData.academicDegreeCertificateNo}}</div>
                        </div>
                      </el-col>
                      <el-col :span="12">
                        <div class="div-flex">
                          <div class="div-flex-left">学历证号：</div>
                          <div class="div-flex-last-right">{{currentData.graduationCertificateNo}}</div>
                        </div>
                      </el-col>
                    </el-row>
                    <el-row class="row-height" type="flex" justify="center">
                      <el-col :span="12">
                        <div class="div-flex">
                          <div class="div-flex-left">培养完成情况:</div>
                          <div class="div-flex-last-right">{{getCultureStatus(currentData.cultureStatus)}}</div>
                        </div>
                      </el-col>
                      <el-col :span="12">
                        <div class="div-flex">
                          <div class="div-flex-left">是否双学位:</div>
                          <div class="div-flex-last-right">{{currentData.isDoubleDegreeI18n}}</div>
                        </div>
                      </el-col>
                  </el-row>
                </div>
            </div>
            <div v-if="readOnly" >
                <div class="dialog-info-title mt-30px mb-22px">离校明细</div>
                <el-form
                    ref="leaveSchoolForm"
                    :model="leaveSchoolDialog.formData"
                    :rules="!readOnly ? '' : rules"
                    label-width="110px"
                    label-position="right"
                    size="mini"
                    class="bg-white"
                >
                    <el-row :gutter="20" type="flex" justify="center">
                        <el-col :span="24">
                            <el-form-item label="离校原因：" prop="leaveReason" style="flex:1">
                                <el-input
                                    v-model="leaveSchoolDialog.formData.leaveReason"
                                    :rows="4"
                                    resize="none"
                                    type="textarea"
                                    style="width:100%"
                                    maxlength="255"
                                    :readonly="!readOnly"
                                />
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :gutter="20">
                        <el-col :span="24">
                            <el-form-item label="附件文件：">
                                <el-upload
                                    :headers="{'X-Token': $store.state.session.sessionid}"
                                    :data="{bucketname: 'face', folderpath: 'file'}"
                                    :limit="1"
                                    action="/api/commonservice/obsfile/uploadfile"
                                    ref="uploadEdit"
                                    accept=".jpg, .bmp, .png, .pdf, .doc, .docx, .xls, .xlsx, .rar, .zip"
                                    :file-list="leaveSchoolDialog.formData.fileList"
                                    :on-success="handlerSuccess"
                                    :on-error="handlerError"
                                    :before-upload="beforeUpload"
                                    :auto-upload="true"
                                >
                                    <el-button size="small" type="primary">
                                        <img
                                            class="vertical-align-middle"
                                            style="margin-right: 8px;"
                                            src="/static/images/icon/upload.png"
                                        />
                                        <span class="vertical-align-middle">点击上传</span>
                                    </el-button>
                                </el-upload>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </div>
            <span slot="buttons">
                <el-button @click="cancleLeaveSchool">返回</el-button>
                <el-button v-if="readOnly" type="primary" @click="sumbitLeaveSchool">提交</el-button>
            </span>
        </edu-dialog>
        <!--撤销弹框-->
        <edu-dialog
            :title="repealDialog.dialogTitle"
            ref="repealDialog"
            class="tip-item"
            @close="closeRepeal"
        >
            确定撤销？
            <span slot="buttons">
                <el-button @click="cancleRepeal">否</el-button>
                <el-button type="primary" @click="confirmRepeal">是</el-button>
            </span>
        </edu-dialog>
        <!--自动离校-->
        <el-dialog
            title="自动离校"
            :visible.sync="dialogTime"
            @close="editCancle"
            width="30%"
        >
        <el-form :model="formInline" ref="formInline" :rules="rule" class="demo-form-inline">
            <el-form-item prop="type">
                <el-radio-group v-model="formInline.type">
                    <el-radio :label="1">按默认离校时间离校</el-radio>
                    <el-radio :label="2">按设置时间离校</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item v-if='formInline.type == 2' prop="leaveTime">
                <el-date-picker
                    style="width: 250px;"
                    v-model="formInline.leaveTime"
                    type="date"
                    value-format="yyyy-MM-dd HH:mm:ss"
                >
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button style="margin-left: 80%;margin-top: 30px;" type="primary" @click="subleave()">提交</el-button>
            </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>
<script>
import * as API from "common/src/api/leaveStudents";
import { queryDic } from "common/src/api/dictionary";
import UTILS from "common/src/utils/utils";
import moment from "moment";
export default {
    name: "LeaveStudentList",
    data() {
        const getGrade = (function() {
            const now = new Date().getFullYear();
            const years = [];
            for (let i = 0; i < 6; i++) {
                years.push({
                    label: now - i,
                    value: now - i
                });
            }
            return years;
        })();
        return {
            multipeQuery: {
                faculty: [],
                profession: [],
                trainingLevel: []
            },
            formInline: {
                type: '',
                leaveTime: null,
                ids: []
            },
            currentime: '',
            dialogTime: false,
            enrolDate: '',
            queryForm: {
                grade: "",
                trainingLevel: "",
                faculty: "",
                profession: "",
                trainingCategory: "",
                degreeType: "",
                formLearning: "",
                cultureStatus: "",
                isGetDiploma: "",
                isGetDegreeCertificate: "",
                leaveSchool: "",
                isOverseas: "",
                isDoubleDegree: "",
                keyWord: "",
                lengthSchooling: '',
                enrolDateStar: null,
                enrolDateEnd: null,
                offSchoolStar: null,
                offSchoolEnd: null,
                pageNum_: 1,
                pageSize_: 20
            },
            options: {
                trainingLevel: [],
                // grade: getGrade,
                faculty: [],
                profession: [],
                formLearning: [],
                cultureStatus: [
                    {
                        label: "已完成",
                        value: "1"
                    },
                    {
                        label: "未完成",
                        value: "0"
                    }
                ],
                degreeType: [],
                trainingCategory: [],
                leaveSchool: [],
                termList: []
            },
            pickerOptions: {
                disabledDate(time) {
                    return (
                        time.getTime() > Date.now() ||
                        time.getTime() < new Date("1978").getTime()
                    );
                }
            },
            students: {
                data: [],
                total_: 0
            },
            selectedItems: [],
            rules: {
                leaveReason: [
                    {
                        required: true,
                        message: "输入不能为空",
                        trigger: "blur"
                    }
                ]
            },
            rule: {
                type: [
                    {
                        required: true,
                        message: "请选择离校方式",
                        trigger: "change"
                    }
                ],
                leaveTime: [
                    {
                        required: true,
                        message: "时间不能为空",
                        trigger: "change"
                    }
                ]
            },
            uploadConfig: {
                fileList: [],
                diplomaCertificateFileList: [],
                graduationCertificateFileList: []
            },
            leaveSchoolDialog: {
                dialogTitle: "离校维护",
                showBasicInfo: true,
                formData: {
                    leaveReason: "",
                    fileList: [],
                    attachFile: ""
                },
                data: {}
            },
            repealDialog: {
                dialogTitle: "撤销",
                data: {}
            },
            uploadType: "upload",
            currentData: {},
            scopeData: {}, // 当前行数据
            currentDptId: "",
            currentUid: "" // 当前uid
        };
    },
    created() {
        if (this.mockUser) {
            this.currentDptId = this.mockUser.currentManageDptId;
            this.currentUid = this.mockUser.uid;
        } else if (this.currentUser) {
            this.currentDptId = this.currentUser.currentManageDptId;
            this.currentUid = this.currentUser.uid;
        }
        this.currentime = moment().format("YYYY-MM-DD 00:00:00"); //当前时间
        this.initOptions();
        this.onSubmit();
    },
    mounted() {},
    methods: {
        // 判断是否为本科生
        isUndergraduate () {
          return this.currentDptId && this.currentDptId.toString() === '1';
        },
        // 判断是否为研究生
        isGraduateStudent () {
          const currentManageDptId = this.currentDptId && this.currentDptId.toString();
          // return currentManageDptId === '2' || currentManageDptId === '4';
          return currentManageDptId !== '1';
        },
        // 是否获得学位证
        isGetAcademicDegreeCertificate (row) {
          if (this.isUndergraduate()) {
            return row.isGetDegreeCertificate * 1 ? '是' : '否';
          }
          return row.academicDegreeCertificateNo ? '是' : '否';

        },
        // 是否获得毕业证
        isGetGraduationCertificate (row) {
          if (this.isUndergraduate()) {
            return row.isGetDiploma * 1 ? '是' : '否';
          }
          return row.graduationCertificateNo ? '是' : '否';
        },
        // 获取学位证
        getDegreeCertificate(val) {
            return val*1 == 1 ? "是" : "否";
        },
        // 获取毕业证
        getDiploma(val) {
            return val*1 == 1 ? "是" : "否";
        },
        // 培养完成情况
        getCultureStatus(val) {
            return val*1 == 1 ? "已完成" : "未完成";
        },
        // 获取【是否国际学生】枚举
        getIsOverseas(val) {
            return val*1 == 1 ? "是" : "否";
        },
        // 初始获取options数据
        initOptions() {
            const data = {
                lang: this.$store.getters.language || "cn",
                type: "allChild",
                keys: ["X_PYCC", "X_YX", "X_PYLB", "X_XWLX", "X_XXXS", "K_ZXZT", 'X_XZ']
            };
            queryDic(data).then(res => {
                if (res.code === 200 && res.data) {
                    UTILS.fillSelect(
                        {
                            faculty: "X_YX",
                            trainingLevel: "X_PYCC",
                            trainingCategory: "X_PYLB",
                            degreeType: "X_XWLX",
                            formLearning: "X_XXXS",
                            leaveSchool: "K_ZXZT",
                            termList: "X_XZ"
                        },
                        res.data,
                        this.options
                    );
                }
                this.options.termList.sort((a,b)=>{ return a.value-b.value});
            });
        },
        // 学院改变时获取专业
        changeFaculty(val) {
            if (!val.length) {
                this.multipeQuery.profession = [];
                this.options.profession = [];
                return;
            }
            this.options.profession = [];
            this.queryForm.profession = "";
            let facultys, degreeType;
            facultys = this.multipeQuery.faculty;
            degreeType = this.queryForm.degreeType
                ? [this.queryForm.degreeType]
                : [];
            const data = {
                lang: this.$store.getters.language || "cn",
                type: "allChild",
                keys: ["G_ZY"],
                filter: {
                    prefix: facultys,
                    specilaCode: "XY2ZY",
                    facultys: facultys,
                    grade: this.queryForm.grade,
                    degreeType: degreeType
                }
            };
            queryDic(data).then(res => {
                if (res.code === 200)
                    UTILS.fillSelect(
                        {
                            profession: "G_ZY"
                        },
                        res.data,
                        this.options
                    );
                this.options.profession = this.options.profession.map((item) => {
                    return {
                        key: item.value,
                        label: item.label + "(" + item.value + ")",
                        value: item.value
                    }
                })
            });
        },
        // 筛选条件过滤数据（页码为1）
        filtration() {
            this.queryForm.pageNum_ = 1;
            this.onSubmit();
        },
        // 处理导入
        handleCommand(command) {
            if (command && command === "import") {
                // 离校导入
                this.$refs.importBtn.click();
            } else if (command && command === "download") {
                // 模板下载
                this.downloadTemplate();
            }
        },
        // 导入学位证书
        handleImportDiplomaCertificate(command) {
          if (command && command === "download") {
            // 模板下载
            window.location.href =
              "/api/studentservice/studentdeparture/downloadDiplomaTemplateTemplate";
            return;
          }
          // 文件导入
          this.$refs.importDiplomaCertificate.click();
        },
        // 导入学历证书
        handleImportGraduationCertificate(command) {
          if (command && command === "download") {
            // 模板下载
            window.location.href =
              "/api/studentservice/studentdeparture/downloadGraduationCertificateTemplate";
            return;
          }
          // 文件导入
          this.$refs.importGraduationCertificate.click();
        },
        timestampToTime(now) {
            var year=now.getFullYear();  //取得4位数的年份
            var month=now.getMonth()+1;  //取得日期中的月份，其中0表示1月，11表示12月
            var date=now.getDate();      //返回日期月份中的天数（1到31）
            var hour=now.getHours();     //返回日期中的小时数（0到23）
            var minute=now.getMinutes(); //返回日期中的分钟数（0到59）
            var second=now.getSeconds(); //返回日期中的秒数（0到59）
            return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
        },
        // 获取离校学生名单列表
        onSubmit() {
            // 清空当前行数据
            this.scopeData = {}
            // faculty等多选数组转换为字符串
            if (this.queryForm.enrolDateStar && this.queryForm.enrolDateEnd) {
                if (this.queryForm.enrolDateEnd < this.queryForm.enrolDateStar) {
                    return this.$message.error('入学结束时间必须晚于开始时间');
                }
            }
            if (this.queryForm.offSchoolStar && this.queryForm.offSchoolEnd) {
                if (this.queryForm.offSchoolEnd < this.queryForm.offSchoolStar) {
                  return this.$message.error('离校结束时间必须晚于开始时间');
                }
            }
            this.queryForm.faculty = this.multipeQuery.faculty.join(",");
            this.queryForm.profession = this.multipeQuery.profession.join(",");
            this.queryForm.trainingLevel = this.multipeQuery.trainingLevel.join(
                ","
            );
            API.getLeaveStudentList(this.queryForm).then(response => {
                if (response.code === 200 && response.data) {
                    this.students.total_ = response.data.total_;
                    this.students.data = response.data.list.map((e) => {
                        if(e.expectedGraduationDate) {
                            return Object.assign(e, {
                                expectedGraduationDate: e.expectedGraduationDate.split(" ")[0]
                            });
                        } else {
                            return Object.assign(e, {
                                expectedGraduationDate: ''
                            });
                        }
                    });
                    this.students.data = response.data.list.map((e) => {
                        if(e.offSchool) {
                            return Object.assign(e, {
                                offSchool: e.offSchool.substring(0,10)
                            });
                        } else {
                            return Object.assign(e, {
                                offSchool: ''
                            });
                        }
                    });
                }
            });
        },
        // 离校撤销操作
        repeal(data) {
            const idx = this.selectedItems.findIndex(
                e => e.studentId == data.studentId
            );
            this.$refs.repealDialog.open();
            if (idx == -1) this.selectedItems.push(data);
            this.currentData = data
            this.scopeData = data

        },
        // 取消离校操作的撤销
        cancleRepeal() {
            this.$refs.repealDialog.close();
        },
        // 关闭repealDialog时触发
        closeRepeal() {
            // 清空当前行数据
            this.scopeData = {}
        },
        // 确定离校操作撤销
        confirmRepeal() {
            let params = {};
            if(this.scopeData) {
                params.ids = [this.scopeData.studentId]
            } else {
                params.ids = this.selectedItems.map(e => e.studentId);
            }
            
            API.revertStudent(params)
                .then(
                    response => {
                        if (response.code === 200) {
                            this.$message({
                                message: "撤销成功",
                                type: "success"
                            });
                        }
                        this.onSubmit();
                    },
                    xhr => {}
                )
                .finally(() => {
                    this.$refs.repealDialog.close();
                    this.selectedItems = [] ;
                });
        },
        // 页码操作
        handleCurrentChange(val) {
            this.queryForm.pageNum_ = val.pageNum;
            this.queryForm.pageSize_ = val.pageSize;
            this.onSubmit();
        },
        // 筛选条件重置
        reset() {
            let multipeQuery = this.multipeQuery;
            let queryForm = this.queryForm;
            for (var key in multipeQuery) {
                multipeQuery[key] = [];
            }
            for (var i in queryForm) {
                if (!i.includes("pageNum_") && !i.includes("pageSize_"))
                    queryForm[i] = "";
            }
            this.options.profession = [];
            this.filtration();
        },
        // 下载离校导入模板
        downloadTemplate() {
            window.location.href =
                "/api/studentservice/studentdeparture/downloadTemplate";
        },
        handleDiplomaImportSuccess(response, file, fileList) {
          this.$refs.importDiplomaCertificateUpload.clearFiles();
          if (response.code.toString() === '200') {
            this.onSubmit();
            this.$message.success( "导入成功");
            return;
          }
          this.$message.error( response.msg);
        },
        handleDiplomaImportError(response, file, fileList) {
          let _this = this;
          _this.$message({
            message: "上传失败，请稍后再试",
            type: "error"
          });
          _this.$refs.importDiplomaCertificateUpload.clearFiles();
        },
        handleImportGraduationSuccess(response, file, fileList) {
          this.$refs.importGraduationCertificateUpload.clearFiles();
          if (response.code.toString() === '200') {
            this.onSubmit();
            this.$message.success( "导入成功");
            return;
          }
          this.$message.error( response.msg);
        },
        handleImportGraduationError(response, file, fileList) {
          this.$refs.importGraduationCertificateUpload.clearFiles();
          this.$message({
            message: "上传失败，请稍后再试",
            type: "error"
          });
        },
        // 离校文件导入成功
        handlerSuccess(response, file, fileList) {
            let _this = this;
            let responseCode = response.code;
            if (!_this.uploadType) {
                _this.onSubmit();
            } else {
                _this.leaveSchoolDialog.formData.attachFile = "";
                if (responseCode === 200) {
                    let name = file && file.name;
                    _this.leaveSchoolDialog.formData.attachFile =
                        name && response.data && response.data[name].objectkey;
                    if (_this.uploadType !== "edit") {
                        _this.$message({
                            message: response.msg,
                            type: "success"
                        });
                        _this.onSubmit();
                    }
                } else {
                    _this.$message({
                        message: response.msg,
                        type: "warning"
                    });
                }
            }
            _this.$refs.upload.clearFiles();
        },
        // 离校文件导入错误
        handlerError(response, file, fileList) {
            let _this = this;
            _this.$message({
                message: "上传失败，请稍后再试",
                type: "error"
            });
            _this.$refs.upload.clearFiles();
        },
        beforeUpload(file) {
            const fileSize = file.size && file.size / 1024 / 1024 < 10;
            let index = file.name && file.name.lastIndexOf(".");
            const fileType = file.name && index && file.name.substr(index);
            var test = /^.(jpg|bmp|png|pdf|doc|docx|xls|xlsx|rar|zip)$/.test(
                fileType
            );
            if (!test) {
                this.$eduAlert("文件格式不符，请检查！", "提示", {
                    type: "warning"
                });
            }
            if (!fileSize) {
                this.$eduAlert("文件最大不能超过10M！", "提示", {
                    type: "warning"
                });
            }
            return fileSize && test;
        },
        // 导出离校学生名单
        exportFile() {
            let params = UTILS.clone(this.queryForm);
            params.hasOwnProperty("pageNum_") && delete params.pageNum_;
            params.hasOwnProperty("pageSize_") && delete params.pageSize_;
            // 选中用选中值未选中用列表值
            if (this.selectedItems.length) {
                params.studentIds = this.selectedItems.map(item => {
                    return item.studentId;
                });
            } else {
                params.studentIds = [];
            }
            API.exportLeaveStudentList(params);
        },
        editCancle() {
            this.$refs['formInline'].resetFields();
            this.dialogTime = false;
        },
        // 自动离校
        leavelonly() {
            const checkDatas = this.$refs.academicTable.getCheckData();
            if (checkDatas.length === 0) {
                this.$message({
                  type: "error",
                  message: '请至少勾选一条数据'
                });
                return false;
            }
            this.dialogTime = true;
            this.formInline.leaveTime = null;
            this.formInline.ids = [];
            for (let i = 0; i < checkDatas.length; i++) {
                this.formInline.ids.push(checkDatas[i].studentId)
            }
        },
        // 提交自动离校
        subleave() {
            if (this.formInline.leaveTime && this.formInline.type == 2) {
                if (this.formInline.leaveTime <= this.currentime) {
                    return this.$message.error('离校时间必须晚于当前时间');
                }
            }
           this.$refs['formInline'].validate(value => {
                if(value) {
                    API.autoDeparture(this.formInline).then( response => {
                        if (response.code == 200) {
                            this.$message({
                                message: "离校成功",
                                type: "success"
                            });
                            this.dialogTime = false;
                            this.onSubmit();
                        }
                        }
                    )
                }
            })
        },
        // 查看
        query(item) {
            this.leaveSchoolDialog.formData.leaveReason = "";
            this.leaveSchoolDialog.dialogTitle = "离校查看";
            this.uploadType = "query";
            this.currentData = item;
            this.$refs.leaveSchoolDialog.open();
            this.leaveSchoolDialog.showBasicInfo = true;

            // if(this.$refs["leaveSchoolForm"]){
            //   this.$refs["leaveSchoolForm"].resetFields();
            // }
        },
        // 单个离校操作
        singleLeaveSchool(item) {
            this.leaveSchoolDialog.formData.leaveReason = "";
            this.leaveSchoolDialog.dialogTitle = "离校维护";
            this.uploadType = "edit";
            this.currentData = item;
            this.scopeData = item
            this.$refs.leaveSchoolDialog.open();
            this.leaveSchoolDialog.showBasicInfo = true;
        },
        // 批量离校操作
        batchLeaveSchool() {
            if (this.selectedItems.length == 0) {
                return this.$eduAlert("请至少选择一条数据", "提示", {
                    confirmButtonText: "确定",
                    type: "warning"
                });
            } else {
                if (this.selectedItems.length === 1) {
                    this.currentData = this.selectedItems[0];
                    this.leaveSchoolDialog.showBasicInfo = true;
                } else {
                    this.leaveSchoolDialog.showBasicInfo = false;
                }
                let isLeaveSchool = this.selectedItems.some(item => {
                    return item.leaveSchool === "4";
                });
                if (isLeaveSchool)
                    return this.$eduAlert(
                        "勾选学生中存在已离校学生，请检查。",
                        "提示",
                        {
                            confirmButtonText: "确定",
                            type: "warning"
                        }
                    );
            }
            this.uploadType = "edit";
            this.$refs.leaveSchoolDialog.open();
        },
        // 处理表格选中的数据
        handlerSelectionChange(val) {
            this.selectedItems = val;
        },
        closeLeaveSchoolDialog() {
            let formData = this.leaveSchoolDialog.formData;
            for (var key in formData) {
                if (formData[key] instanceof Array) {
                    formData[key] = [];
                } else {
                    formData[key] = "";
                }
            }
            if (this.uploadType && this.readOnly) {
                this.$refs.uploadEdit.clearFiles();
            }
            this.uploadType = null;
            if (this.$refs['leaveSchoolForm']) {
              this.$refs['leaveSchoolForm'].resetFields();
            }
            // 清空当前行数据
            this.scopeData = {}
        },
        // 提交离校
        sumbitLeaveSchool() {
            // let params = {
            //     ...this.currentData
            // };
            // params.expectLeaveDate = ""
            let params = {};
            params.leaveReason = this.leaveSchoolDialog.formData.leaveReason;
            params.attachFile = this.leaveSchoolDialog.formData.attachFile;
            params.ids = [];
            if (this.scopeData && this.scopeData.studentId) {
                params.ids.push(this.scopeData.studentId);
            } else {
                params.ids = this.selectedItems.map(item => {
                    return item.studentId;
                });
            }
                
            //params.hasOwnProperty('keyWord') && delete params.keyWord
            params.hasOwnProperty("pageNum_") && delete params.pageNum_;
            params.hasOwnProperty("pageSize_") && delete params.pageSize_;
            this.$refs.leaveSchoolForm.validate(valid => {
                if (valid) {
                    API.batchLeaveSchool(params)
                        .then(
                            response => {
                                if (response.code == 200) {
                                    this.$message({
                                        message: "离校成功",
                                        type: "success"
                                    });
                                    this.onSubmit();
                                }
                            },
                            xhr => {}
                        )
                        .finally(() => {
                            this.$refs.leaveSchoolDialog.close();
                            this.$refs.innerDialog.close();
                        });
                }
            });
        },
        // 取消离校操作
        cancleLeaveSchool() {
            let formData = this.leaveSchoolDialog.formData;
            if (!this.readOnly) {
                this.$refs.leaveSchoolDialog.close()
            } else {
                if (formData.leaveReason || formData.fileList.length)
                  this.$refs.innerDialog.open();
                else this.$refs.leaveSchoolDialog.close();
            }
        },
        // 内部innerDialog 取消操作
        cancleInner() {
            this.$refs.innerDialog.close();
        },
        // 内部innerDialog 确定操作
        confirmInner() {
            this.cancleInner();
            this.$refs.leaveSchoolDialog.close();
        },
        // 内部innerDialog 保存并关闭操作
        confirmAndSave() {
            this.sumbitLeaveSchool();
        }
    },
    computed: {
        readOnly() {
            return this.uploadType != 'query';
        },
        currentUser() {
            if (this.$store.state.session.user) {
                return this.$store.state.session.user;
            }
            return JSON.parse(localStorage.getItem("user"));
        },
        mockUser() {
            if (this.$store.state.session.mockUser) {
                return this.$store.state.session.mockUser;
            }
            let sessiondata = JSON.parse(localStorage.getItem("sessiondata"));
            if (sessiondata && sessiondata.mockUser) {
                return sessiondata.mockUser;
            }
        }
    }
};
</script>
<style lang="scss" scoped>
$lineHeight: 30px;
.leave-student-list {
    .details-table {
        border: 2px solid #e5e9f2;
        background-color: rgba(245, 247, 249, 1);
    }
    .row-height {
        height: $lineHeight;
        text-align: center;
        border-bottom: 1px solid #e5e9f2;
        .div-flex {
            display: flex;
            height: 100%;
            &.div-left {
                justify-content: flex-start;
            }
            .div-flex-left {
                flex: 1;
                text-align: right;
                padding-right: 5px;
                height: 100%;
                border-right: 1px solid #e5e9f2;
                border-left: 1px solid #e5e9f2;
                // background-color: rgba(245, 247, 249, 1);
                line-height: $lineHeight;
            }
            .div-flex-last-right {
                flex: 2;
                text-align: left;
                padding: 0 10px;
                line-height: 30px;
            }
        }
    }
    .dialog {
        font-family: "微软雅黑 Regular,微软雅黑";
        .dialog-title {
            font-size: 18px;
            color: #4c5c70;
        }
        .dialog-info-title {
            font-size: 18px;
            color: #2b3b4e;
        }
        .mt-10px {
            margin-top: 10px;
        }
        .mt-30px {
            margin-top: 30px;
        }
        .mb-24px {
            margin-bottom: 24px;
        }
        .mb-22px {
            margin-bottom: 22px;
        }
    }
}
</style>
<style lang="scss">
.leave-student-list {
    .el-table__header {
        width: 100% !important;
    }
}
</style>
